﻿@{
    ViewBag.Title = "新账号配置页面";
    Layout = "~/Views/Shared/IniterBaseView.cshtml";
}
<script type="text/javascript">
    function Delete(id) {
        if (confirm("确定要删除账号吗？")) {
            location.href = "/Operator/OperatorAccountDelete/" + id;
        }
    }

    function Edit(id) {
        location.href = "/Operator/OperatorAccountEdit/" + id;
    }
</script>
<div style="height: 40px; width: 100%; line-height: 40px;">
    <p>
        &nbsp;
    </p>
</div>
<div style="font-size: 22pt; text-align: center;">
    账号使用者<span style="font-size: 9pt;"> 确认</span></div>
<div style="height: 20px; width: 100%; line-height: 20px;">
    <p>
        &nbsp;
    </p>
</div>
<form method="post" action="" id="form1">
<div style="width: 100%; text-align: center; padding-left: 10%;" align="center">
    @{
        if (ViewBag.unSavedServerAccount.Count > 0)
        {
        <table style="width: 80%;" class="list">
            <tr>
                <td class="title">
                    账号
                </td>
                <td class="title">
                    设定使用者
                </td>
            </tr>
            @foreach (BenefitHelper.Data.ServerData.T_Account account in ViewBag.unSavedServerAccount)
            {
                <tr>
                    <td>
                        @account.LoginAccount
                    </td>
                    <td>
                        @Html.ActionLink("设定使用者", "CreateOperatorAccount/" + account.Id, "Operator", null, null)
                    </td>
                </tr>
            }
        </table>
        <div style="line-height: 10px; height: 10px; width: 100%;">
            &nbsp;</div>
        }
    }
    <table style="width: 80%;" class="list">
        <tr>
            <td class="title">
                账号
            </td>
            <td class="title">
                使用者
            </td>
            <td class="title">
                编辑
            </td>
            <td class="title">
                删除
            </td>
        </tr>
        @foreach (BenefitHelper.Sys.Account t in ViewBag.serverAccounts)
        {
            <tr>
                <td>
                    @t.AccountName
                </td>
                <td>
                    @{
            List<BenefitHelper.Sys.OperatorAccount> oas = ViewBag.oas;
            var query = oas.Where(a => a.AccountId == t.Id);
            if (query.Count() > 0)
            {
                List<BenefitHelper.Sys.Operator> operators = ViewBag.operators;
                foreach (BenefitHelper.Sys.Operator op in operators)
                {
                    if (op.Id == query.First().OperatorId)
                    {
                        <span>@op.UName</span>
                    }
                }
            }
                    }
                </td>
                <td style="width: 80px;">
                    <span onclick="Edit(@t.Id)" style="">编辑</span>
                </td>
                <td style="width: 80px;">
                    <span onclick="Delete(@t.Id)" style="">删除</span>
                </td>
            </tr>
       
        }
    </table>
</div>
</form>
<div style="height: 20px; width: 100%; line-height: 20px;">
    <p>
        &nbsp;
    </p>
</div>
<div style="font-size: 16pt; text-align: center;" class="list">
    <span style="font-size: 9pt;" onclick="javascript:location.href='/Init/AddNewOperator'">
        上一步</span> 点击 <a href="/init/SelectDate">下一步</a> 继续
</div>
<div style="height: 40px; width: 100%; line-height: 40px;">
    <p>
        &nbsp;
    </p>
</div>
